package com.jeesite.common.pojo;

import com.jeesite.modules.sys.entity.User;
import lombok.Data;

import java.text.SimpleDateFormat;

/**
 * @ClassName LoginUser
 * @Description 登录用户信息
 * @Author Spencer Zhang
 * @Date 2025/2/15 23:31
 */
@Data
public class LoginUser {
    private String id;
    private String createBy;
    private String updateBy;
    private String status;
    private String createDate;
    private String updateDate;
    private String userName;
    private String userType;
    private String lastLoginIp;
    private String userWeight;
    private String userCode;
    private String refName;
    private String lastLoginDate;
    private String refCode;
    private String loginCode;
    private String mgrType;


    public LoginUser() {
    }

    public LoginUser(User user) {
        id = user.getId();
        createBy = user.getCreateBy();
        updateBy = user.getUpdateBy();
        status = user.getStatus();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (user.getCreateDate() != null)
            createDate = sdf.format(user.getCreateDate());
        if (user.getUpdateDate() != null)
            updateDate = sdf.format(user.getUpdateDate());
        userName = user.getUserName();
        userType = user.getUserType();
        lastLoginIp = user.getLastLoginIp();
        if (user.getUserWeight() != null)
            userWeight = user.getUserWeight().toString();
        userCode = user.getUserCode();
        refName = user.getRefName();
        if (user.getLastLoginDate() != null)
            lastLoginDate = sdf.format(user.getLastLoginDate());
        refCode = user.getRefCode();
        loginCode = user.getLoginCode();
        mgrType = user.getMgrType();

    }
}